import os
import shutil

gen=os.walk(".\\data_ana")

while True:

    try:

        info=next(gen)

    except StopIteration:

        print('__pycache__文件夹删除成功')

        break
        
    if '__pycache__' in info[1]:

        path=os.path.join(info[0],'__pycache__')

        shutil.rmtree(path)

        
    

